package com.yc.controller;

import com.yc.entity.LeavereQuests;
import com.yc.service.LeavereQuestsService;
import com.yc.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author zhupanlin
 * @version 1.0
 * @description: TODO
 * @date 2023/7/29 15:01
 */
@Api("请假信息控制器")
@RestController
@RequestMapping("/leave")
public class LeavereQuestsController {

    @Resource
    private LeavereQuestsService leavereQuestsService;

    @ApiOperation("通过请假Id获取请假信息")
    @GetMapping("/get/{leaveId}")
    public Result selectByLeaveId(@ApiParam(name = "leaveId", value = "请假Id", required = true)
                                  @PathVariable("leaveId") String leaveId){
        LeavereQuests leavereQuests = leavereQuestsService.selectByLeaveId(leaveId);
        return Result.success(leavereQuests);
    }

    @ApiOperation("通过学生学号查询请假信息")
    @GetMapping("/get/student/{stuid}")
    public Result selectByStuid(@ApiParam(name = "stuid", value = "学生学号", required = true)
                                    @PathVariable("stuid") String stuid){
        LeavereQuests leavereQuests = leavereQuestsService.selectByStuid(stuid);
        return Result.success(leavereQuests);
    }

}
